package com.jboost.config.mybatis;

import lombok.extern.slf4j.Slf4j;

/**
 * 多产品域 存储器
 */
@Slf4j
public class DomainContext {

    private static ThreadLocal<String> currentDomain = new ThreadLocal<>();
    private static ThreadLocal<String> currentClient = new ThreadLocal<>();

    public static void setDomain(String domain) {
        log.debug(" setting domain to " + domain);
        currentDomain.set(domain);
    }

    public static String getDomain() {
        return currentDomain.get();
    }

    public static void setClient(String client) {
        log.debug(" setting client to " + client);
        currentClient.set(client);
    }

    public static String getClient() {
        return currentClient.get();
    }

    public static void clear(){
        currentDomain.remove();
        currentClient.remove();
    }
}
